package com.sk.bilibili.utils;

import android.content.Context;

public class DensityUtils {

    private float scale;

    public DensityUtils(Context context) {
        scale = context.getResources().getDisplayMetrics().density;
    }

    public int dip2px(float dpValue) {
        return (int) (dpValue * scale + 0.5f);
    }

    public int px2dip(float pxValue) {
        return (int) (pxValue / scale + 0.5f);
    }

}